log := thirdparty/log/log.c thirdparty/log/log.h
Json := thirdparty/cJSON/cJSON.c thirdparty/cJSON/cJSON.h
App_common := app/app_common.c app/app_common.h
App_message := app/app_message.c app/app_message.h
App_mqtt := app/app_mqtt.c app/app_mqtt.h
App_pool := app/app_pool.c app/app_pool.h
App_buffer := app/app_buffer.c app/app_buffer.h
App_device := app/app_device.c app/app_device.h
App_ble := app/app_ble.c app/app_ble.h

common_Test: test/app_common_test.c $(log) $(App_common)
	-gcc $^ -o $@ -I thirdparty -I app
	-./$@
	-rm $@

message_test: test/app_message_test.c $(log) $(App_common) $(App_message) $(Json)
	-gcc $^ -o $@ -I thirdparty -I app
	-./$@
	-rm $@

mqtt_test: test/app_mqtt_test.c $(App_mqtt) $(log)
	-gcc $^ -o $@ -Iapp -I thirdparty -lpaho-mqtt3c
	-./$@
	-rm $@

pool_test: test/app_pool_test.c $(App_pool) $(log)
	-gcc $^ -o $@ -I app -I thirdparty
	-./$@
	-rm $@

buffer_test: test/app_buffer_test.c $(App_buffer) $(log)
	-gcc $^ -o $@ -I app -I thirdparty
	-./$@
	-rm $@

device_test: test/app_device_test.c $(App_ble) $(App_device) $(log) $(App_buffer) $(App_message) $(App_common) $(Json) $(App_pool) $(App_mqtt) $(App_message) 
	-gcc $^ -o $@ -Ithirdparty -I app -lpaho-mqtt3c
	-./$@
	-rm $@
